package bill.java.lab.client.bitManipulations;

import java.util.Date;

public class BitwiseOp {
	final static int xyz = 5;
	final static Date billBirthday = new Date(30, 12, 05);
	public static void main(String ars[]){
		int i = 7;
		int end = 90;
		int start = 40;
		int mid = (end+start)/2;
		int midshift = (end+start) >>> 1;
		System.out.println(i >>> 2);
		
		packing(45, 1, 5);
		
		System.out.println(" bill was born in " + billBirthday .getYear());
		billBirthday.setYear(50);
		System.out.println(" bill was born in " + billBirthday .getYear());
		
		packing(45, 1, 5);
		
//		 xyz =6;
//		 billBirthday = null;
//		System.out.println("xyz : " +
	}

	
	public static void packing(int age, int gender, int height){
		
		
		System.out.println("age  " + age);
		System.out.println("gender  " + gender);
		System.out.println("height  " + height);
		int packed = 0;
		 packed =( (( age << 1 ) | gender)<< 7 ) | height;
        
		
		int unpackedHeight = packed & 0x7F;
		int uppackedGender = packed >>> 7 & 1;
		int uppackedAge = packed >>> 8;
		Integer i = null;
		
		System.out.println("unpackedHeight  " + unpackedHeight);
		System.out.println("uppackedGender  " + uppackedGender);
		System.out.println("uppackedAge  " + uppackedAge);
		
	}
	
	
}
